package cn.yangliu.web;

import cn.yangliu.comm.BaseComponent;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 作者 杨柳
 * 创建时间 2017-08-29 10:15
 */

/**
 * 异步方法 不获取到返回值
 */
@Component
public class AsyncTask extends BaseComponent{

    @Async
    public void test1() {
        try {
            Thread.sleep(5000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       logger.info("任务1执行成功");
    }

    @Async
    public void test2() {
        try {
            Thread.sleep(5000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       logger.info("任务2执行成功");
    }

    @Async
    public void test3() {
        try {
            Thread.sleep(5000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       logger.info("任务3执行成功");
    }


}
